[vars]
desc='profiling tool using instrumentation facilities provided by the kernel'
LINUX_VER=$(cat "$K"/kernel.version)
tarball=linux-"$LINUX_VER".tar.xz

[deps]
kernel-tarball
libelf

[build]
patch -p1 < "$K"/linux-4.10-perf-sysconf.patch
cd tools/perf
cat << EOF > hack.h
#ifndef __ASSEMBLER__
#include <string.h>
#include <errno.h>
#define sched_getcpu() (errno = ENOSYS, -1)
#define strerror_r(a,b,c) ((strerror_r)(a,b,c),b)
#endif
EOF

make WERROR=0 V=1 EXTRA_CFLAGS="-I$PWD -include hack.h $optcflags" \
LDFLAGS="$optldflags -static" NO_LIBPYTHON=1
install -Dm 755  perf "$butch_install_dir""$butch_prefix"/bin/perf
